home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 005 / finance.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1984-04-24  |  28.8 KB  |  1,153 lines

  1. 10  DIM PE(1000),DOW$(7),MD(13),MOY$(12)
  2. 20  DEFDBL X
  3. 30  DEF FND(X)=MD(X)-MD(X-1)
  4. 40  PAT1$="$$#########.##"
  5. 50  PAT2$="####"
  6. 60  PAT3$="###.##"
  7. 70  PAT4$="##.#######"
  8. 80  PAT5$="######"
  9. 90  PAT6$="##"
  10. 100  IN1$="Present value, in dollars       $ "
  11. 110  IN2$="Future value, in dollars        $ "
  12. 120  IN3$="Annual interest rate, in %        "
  13. 130  IN4$="Number of periods per year        "
  14. 140  IN5$="Periodic payment, in dollars    $ "
  15. 150  IN6$="Enter the time period             "
  16. 160  IN7$="Initial loan amount, in dollars $ "
  17. 170  PR1$="What would you like to do next?"
  18. 180  PR2$="Enter your choice"
  19. 190  PR3$="Using the form YY,MM,DD   (enter zero's if necessary)"
  20. 200  PR4$="Time period of"
  21. 210  PR5$="years"
  22. 220  PR6$="months and"
  23. 230  PR7$="days or"
  24. 240  PR8$="periods."
  25. 250  PR9$="Present value       "
  26. 260  PR10$="Future value        "
  27. 270  PR11$="Annual interest rate        "
  28. 280  PR12$="Periods per year              "
  29. 290  PR13$="Initial loan amount "
  30. 300  PR14$="Simple interest     "
  31. 310  PR15$="Interest per period "
  32. 320  PR16$="Periodic payment    "
  33. 330  CLS:KEY OFF:SCREEN 0,0,0:WIDTH 80
  34. 340  ON ERROR GOTO 690
  35. 350  PRINT "Enter the number of one of the following programs."
  36. 360  PRINT
  37. 370  PRINT "     1 - Present value of a future sum"
  38. 380  PRINT "     2 - Simple interest"
  39. 390  PRINT "     3 - Future value of a present sum"
  40. 400  PRINT "     4 - Amortization schedule"
  41. 410  PRINT "     5 - Interest rate for compound interest"
  42. 420  PRINT "     6 - Interest rate for installment loans"
  43. 430  PRINT "     7 - Date arithmetic"
  44. 440  PRINT "     8 - Term of an installment loan"
  45. 450  PRINT "     9 - Present value of series of payments"
  46. 460  PRINT "    10 - Real estate capital investment"
  47. 470  PRINT "    11 - Nominal and effective interest rates"
  48. 480  PRINT "    12 - Internal rate of return"
  49. 490  PRINT "    13 - Future value of regular deposits"
  50. 500  PRINT "    14 - Regular deposits for future value"
  51. 510  PRINT "    15 - Depreciation - amount"
  52. 520  PRINT "    16 - Depreciation - rate"
  53. 530  PRINT "    17 - Depreciation - salvage value"
  54. 540  PRINT "    18 - Depreciation - schedule"
  55. 550  PRINT "    19 - Bond - present value"
  56. 560  PRINT "    20 - Bond - yield to maturity"
  57. 570  PRINT
  58. 580  INPUT "Type program number (or space bar to exit) and press ENTER ",F
  59. 590  IF F=0 THEN CLS:ON ERROR GOTO 0:END
  60. 600  IF F<0 OR F>20 GOTO 640
  61. 610  CLS
  62. 620  C=0
  63. 630  ON F GOTO 1000,2000,3000,4000,5000,6000,7000,8000,9000,640,11000,12000,13000,14000,15000,16000,17000,640,19000,20000
  64. 640  CLS
  65. 650  PRINT "The program number you have selected (";F;") does not exist."
  66. 660  PRINT "Press any key to return to the main menu."
  67. 670  IF LEN(INKEY$)<1 GOTO 670
  68. 680  GOTO 330
  69. 690  CLS
  70. 700  PRINT "Error ";ERR;" has occurred on line # ";ERL
  71. 710  PRINT "Press any key to continue."
  72. 720  IF LEN(INKEY$)<1 GOTO 720
  73. 730  RESUME 630
  74. 1000  PRINT "This program calculates the present value of"
  75. 1010  PRINT "a future sum, discounting it for a particular"
  76. 1020  PRINT "interest rate, compounded as instructed."
  77. 1030  PRINT
  78. 1040  PRINT IN2$;:INPUT "",FV
  79. 1050  IF C=1 GOTO 1140
  80. 1060  PRINT IN3$;:INPUT "",AIR
  81. 1070  IF C=2 GOTO 1130
  82. 1080  PRINT IN4$;:INPUT "",NPPY
  83. 1090  IF C=3 GOTO 1120
  84. 1100  PRINT PR3$
  85. 1110  PRINT IN6$;:INPUT "",YY,MM,DD
  86. 1120  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  87. 1130  IR=AIR/(100*NPPY)
  88. 1140  PV=FV*(1+IR)^(-NP)
  89. 1150  CLS
  90. 1160  PRINT PR10$;:PRINT USING PAT1$;FV
  91. 1170  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  92. 1180  PRINT PR12$;:PRINT USING PAT2$;NPPY
  93. 1190  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  94. 1200  PRINT
  95. 1210  COLOR 15,0
  96. 1220  PRINT PR9$;:PRINT USING PAT1$;PV
  97. 1230  COLOR 7,0
  98. 1240  PRINT
  99. 1250  PRINT PR1$
  100. 1260  PRINT
  101. 1270  PRINT "1 - Change future value"
  102. 1280  PRINT "2 - Change annual interest rate"
  103. 1290  PRINT "3 - Change number of periods per year"
  104. 1300  PRINT "4 - Change time period"
  105. 1310  PRINT "5 - Rerun using all new values"
  106. 1320  PRINT "6 - Return to main menu"
  107. 1330  PRINT
  108. 1340  PRINT PR2$
  109. 1350  C=VAL(INKEY$)
  110. 1360  IF C<1 OR C>6 GOTO 1350
  111. 1370  ON C GOTO 1040,1060,1080,1100,610,330
  112. 2000  PRINT "This routine calculates simple interest on"
  113. 2010  PRINT "dollars held in deposit for a specified period"
  114. 2020  PRINT "using a given percentage of interest."
  115. 2030  PRINT
  116. 2040  PRINT IN1$;:INPUT "",PV
  117. 2050  IF C=1 GOTO 2140
  118. 2060  PRINT IN3$;:INPUT "",AIR
  119. 2070  IF C=2 GOTO 2130
  120. 2080  PRINT IN4$;:INPUT "",NPPY
  121. 2090  IF C=3 GOTO 2120
  122. 2100  PRINT PR3$
  123. 2110  PRINT IN6$;:INPUT "",YY,MM,DD
  124. 2120  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  125. 2130  IR=AIR/(100*NPPY)
  126. 2140  I=IR*NP*PV
  127. 2150  FV=PV+I
  128. 2160  CLS
  129. 2170  PRINT PR9$;:PRINT USING PAT1$;PV
  130. 2180  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  131. 2190  PRINT PR12$;:PRINT USING PAT2$;NPPY
  132. 2200  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  133. 2210  PRINT
  134. 2220  COLOR 15,0
  135. 2230  PRINT PR14$;:PRINT USING PAT1$;I
  136. 2240  PRINT PR15$;:PRINT USING PAT1$;I/NP
  137. 2250  PRINT PR10$;:PRINT USING PAT1$;FV
  138. 2260  COLOR 7,0
  139. 2270  PRINT
  140. 2280  PRINT PR1$
  141. 2290  PRINT
  142. 2300  PRINT "1 - Change present value"
  143. 2310  PRINT "2 - Change annual interest rate"
  144. 2320  PRINT "3 - Change number of periods per year"
  145. 2330  PRINT "4 - Change time period"
  146. 2340  PRINT "5 - Rerun using all new values"
  147. 2350  PRINT "6 - Return to main menu"
  148. 2360  PRINT
  149. 2370  PRINT PR2$
  150. 2380  C=VAL(INKEY$)
  151. 2390  IF C<1 OR C>6 GOTO 2380
  152. 2400  ON C GOTO 2040,2060,2080,2100,610,330
  153. 3000  PRINT "This program calculates the future value of"
  154. 3010  PRINT "a present sum held for a specified period,"
  155. 3020  PRINT "and interest compounded at the given rate."
  156. 3030  PRINT
  157. 3040  PRINT IN1$;:INPUT "",PV
  158. 3050  IF C=1 GOTO 3140
  159. 3060  PRINT IN3$;:INPUT "",AIR
  160. 3070  IF C=2 GOTO 3130
  161. 3080  PRINT IN4$;:INPUT "",NPPY
  162. 3090  IF C=3 GOTO 3120
  163. 3100  PRINT PR3$
  164. 3110  PRINT IN6$;:INPUT "",YY,MM,DD
  165. 3120  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  166. 3130  IR=AIR/(100*NPPY)
  167. 3140  FV=PV*(1+IR)^NP
  168. 3150  CLS
  169. 3160  PRINT PR9$;:PRINT USING PAT1$;PV
  170. 3170  PRINT PR11$;:PRINT USING PAT3$;AIR
  171. 3180  PRINT PR12$;:PRINT USING PAT2$;NPPY
  172. 3190  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  173. 3200  PRINT
  174. 3210  COLOR 15,0
  175. 3220  PRINT PR10$;:PRINT USING PAT1$;FV
  176. 3230  COLOR 7,0
  177. 3240  PRINT
  178. 3250  PRINT PR1$
  179. 3260  PRINT
  180. 3270  PRINT "1 - Change present value"
  181. 3280  PRINT "2 - Change annual interest rate"
  182. 3290  PRINT "3 - Change number of periods per year"
  183. 3300  PRINT "4 - Change time period"
  184. 3310  PRINT "5 - Rerun using all new values"
  185. 3320  PRINT "6 - Return to main menu"
  186. 3330  PRINT
  187. 3340  PRINT PR2$
  188. 3350  C=VAL(INKEY$)
  189. 3360  IF C<1 OR C>6 GOTO 3350
  190. 3370  ON C GOTO 3040,3060,3080,3100,610,330
  191. 4000  PRINT "This program produces an amortization schedule"
  192. 4010  PRINT "given the initial loan amount, the interest rate"
  193. 4020  PRINT "and the time period of the loan.  The schedule"
  194. 4030  PRINT "will begin at payment number 1 but this can be"
  195. 4040  PRINT "modified during execution."
  196. 4050  PRINT
  197. 4060  PRINT IN7$;:INPUT "",PV
  198. 4070  IF C=1 GOTO 4160
  199. 4080  PRINT IN3$;:INPUT "",AIR
  200. 4090  IF C=2 GOTO 4150
  201. 4100  PRINT IN4$;:INPUT "",NPPY
  202. 4110  IF C=3 GOTO 4140
  203. 4120  PRINT PR3$
  204. 4130  PRINT IN6$;:INPUT "",YY,MM,DD
  205. 4140  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  206. 4150  IR=AIR/(100*NPPY)
  207. 4160  PMT=PV*(IR/(1-(1+IR)^(-NP)))
  208. 4170  B=1
  209. 4180  CLS
  210. 4190  TINT=0
  211. 4200  PRINT PR13$;:PRINT USING PAT1$;PV
  212. 4210  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  213. 4220  PRINT PR12$;:PRINT USING PAT2$;NPPY
  214. 4230  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  215. 4240  COLOR 15,0
  216. 4250  PRINT PR16$;:PRINT USING PAT1$;PMT
  217. 4260  PRINT
  218. 4270  PRINT "Payment   Remaining     Principal     Principal     Interest      Interest"
  219. 4280  PRINT "Number    Principal      Payment     Loan to date    Payment     Page to date"
  220. 4290  E=B+11
  221. 4300  IF E>NP THEN E=NP
  222. 4310  FOR I=B TO E
  223. 4320  K=I
  224. 4330  GOSUB 4610
  225. 4340  BALI=BAL
  226. 4350  K=K-1
  227. 4360  GOSUB 4610
  228. 4370  BALI1=BAL
  229. 4380  INTR=BALI-BALI1+PMT
  230. 4390  PRIN=PMT-INTR
  231. 4400  TPRIN=PV-BALI
  232. 4410  TINT=TINT+INTR
  233. 4420  PRINT USING PAT2$;I;:PRINT USING PAT1$;BALI,PRIN,TPRIN,INTR,TINT
  234. 4430  NEXT I
  235. 4440  PRINT
  236. 4450  COLOR 7,0
  237. 4460  PRINT "Press ENTER to continue with next 12 periods.   Enter a beginning"
  238. 4470  INPUT "payment number if desired or enter 0 to quit.   ",A$
  239. 4480  IF A$<>"" GOTO 4550
  240. 4490  IF E<>NP GOTO 4530
  241. 4500  LOCATE CSRLIN-2,1
  242. 4510  PRINT "Payment number";:PRINT USING PAT2$;NP;:PRINT " was the last payment.        Enter a beginning"
  243. 4520  GOTO 4470
  244. 4530  B=B+12
  245. 4540  GOTO 4180
  246. 4550  IF A$=" " OR A$="0" GOTO 4630
  247. 4560  B=VAL(A$)
  248. 4570  IF B>=1 AND B<=NP GOTO 4180
  249. 4580  PRINT "Input was not 0 to quit, blank to continue or between 1 and";NP
  250. 4590  LOCATE CSRLIN-3,1
  251. 4600  GOTO 4460
  252. 4610  BAL=(1/(1+IR)^(-K))*((PMT*((1+IR)^(-K)-1))/IR+PV)
  253. 4620  RETURN
  254. 4630  CLS
  255. 4640  PRINT PR13$;:PRINT USING PAT1$;PV
  256. 4650  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  257. 4660  PRINT PR12$;:PRINT USING PAT2$;NPPY
  258. 4670  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  259. 4680  COLOR 15,0
  260. 4690  PRINT PR16$;:PRINT USING PAT1$;PMT
  261. 4700  COLOR 7,0
  262. 4710  PRINT
  263. 4720  PRINT PR1$
  264. 4730  PRINT
  265. 4740  PRINT "1 - Change initial loan amount"
  266. 4750  PRINT "2 - Change annual interest rate"
  267. 4760  PRINT "3 - Change number of payments per year"
  268. 4770  PRINT "4 - Change time period"
  269. 4780  PRINT "5 - Specify periodic payment"
  270. 4790  PRINT "6 - Rerun using all new values"
  271. 4800  PRINT "7 - Return to main menu"
  272. 4810  PRINT
  273. 4820  PRINT PR2$
  274. 4830  C=VAL(INKEY$)
  275. 4840  IF C<1 OR C>7 GOTO 4830
  276. 4850  ON C GOTO 4060,4080,4100,4120,4860,610,330
  277. 4860  PRINT IN5$;:INPUT "",PMT
  278. 4870  GOTO 4170
  279. 5000  PRINT "This routine calculates the compound interest rate"
  280. 5010  PRINT "on dollars held in deposit for a specified period."
  281. 5020  PRINT
  282. 5030  PRINT IN1$;:INPUT "",PV
  283. 5040  IF C=1 GOTO 5110
  284. 5050  PRINT IN2$;:INPUT "",FV
  285. 5060  IF C=2 GOTO 5110
  286. 5070  PRINT IN4$;:INPUT "",NPPY
  287. 5080  IF C=3 GOTO 5110
  288. 5090  PRINT PR3$
  289. 5100  PRINT IN6$;:INPUT "",YY,MM,DD
  290. 5110  NP=CINT(NPPY*(YY+MM/12+YY/365.25))
  291. 5120  IR=((FV/PV)^(1/NP)-1)*100*NPPY
  292. 5130  CLS
  293. 5140  PRINT PR9$;:PRINT USING PAT1$;PV
  294. 5150  PRINT PR10$;:PRINT USING PAT1$;FV
  295. 5160  PRINT PR12$;:PRINT USING PAT2$;NPPY
  296. 5170  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  297. 5180  PRINT
  298. 5190  COLOR 15,0
  299. 5200  PRINT PR11$;:PRINT USING PAT3$;IR;:PRINT " %"
  300. 5210  COLOR 7,0
  301. 5220  PRINT
  302. 5230  PRINT PR1$
  303. 5240  PRINT
  304. 5250  PRINT "1 - Change present value"
  305. 5260  PRINT "2 - Change future value"
  306. 5270  PRINT "3 - Change number of periods per year"
  307. 5280  PRINT "4 - Change time period"
  308. 5290  PRINT "5 - Rerun using all new values"
  309. 5300  PRINT "6 - Return to main menu"
  310. 5310  PRINT
  311. 5320  PRINT PR2$
  312. 5330  C=VAL(INKEY$)
  313. 5340  IF C<1 OR C>6 GOTO 5330
  314. 5350  ON C GOTO 5030,5050,5070,5090,610,330
  315. 6000  PRINT "This routine determines the annual interest rate of"
  316. 6010  PRINT "an installment loan given the initial loan amount,"
  317. 6020  PRINT "the periodic payment, and the time period of the loan."
  318. 6030  PRINT
  319. 6040  PRINT IN7$;:INPUT "",PV
  320. 6050  IF C=1 GOTO 6130
  321. 6060  PRINT IN5$;:INPUT "",PMT
  322. 6070  IF C=2 GOTO 6130
  323. 6080  PRINT IN4$;:INPUT "",NPPY
  324. 6090  IF C=3 GOTO 6130
  325. 6100  PRINT PR3$
  326. 6110  PRINT IN6$;:INPUT "",YY,MM,DD
  327. 6120  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  328. 6130  IR=(PMT/PV)-(PV/(PMT*NP^2))
  329. 6140  FI=(1-(1+IR)^(-NP))-IR*PV/PMT
  330. 6150  DFI=((((NP/(1+1/IR))+1)*(1+IR)^(-NP))-1)/IR
  331. 6160  IR=IR-FI/DFI
  332. 6170  LOCATE 25,1
  333. 6180  PRINT USING PAT4$;ABS(FI/DFI);
  334. 6190  IF ABS(FI/DFI)>9.99E-07 GOTO 6140
  335. 6200  IR=IR*NPPY*100
  336. 6210  CLS
  337. 6220  PRINT PR13$;:PRINT USING PAT1$;PV
  338. 6230  PRINT PR16$;:PRINT USING PAT1$;PMT
  339. 6240  PRINT PR12$;:PRINT USING PAT2$;NPPY
  340. 6250  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  341. 6260  PRINT
  342. 6270  COLOR 15,0
  343. 6280  PRINT PR11$;:PRINT USING PAT3$;IR;:PRINT " %"
  344. 6290  COLOR 7,0
  345. 6300  PRINT
  346. 6310  PRINT PR1$
  347. 6320  PRINT
  348. 6330  PRINT "1 - Change initial loan amount"
  349. 6340  PRINT "2 - Change periodic payment"
  350. 6350  PRINT "3 - Change number of periods per year"
  351. 6360  PRINT "4 - Change time period"
  352. 6370  PRINT "5 - Rerun using all new values"
  353. 6380  PRINT "6 - Return to main menu"
  354. 6390  PRINT
  355. 6400  PRINT PR2$
  356. 6410  C=VAL(INKEY$)
  357. 6420  IF C<1 OR C>6 GOTO 6410
  358. 6430  ON C GOTO 6040,6060,6080,6100,610,330
  359. 7000  RESTORE 7003
  360. 7003  DATA 0,31,59,90,120,151,181,212,243,273,304,334,365
  361. 7006  FOR I=0 TO 12
  362. 7009  READ MD(I)
  363. 7012  NEXT I
  364. 7015  DATA Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
  365. 7018  FOR I=0 TO 6
  366. 7021  READ DOW$(I)
  367. 7024  NEXT I
  368. 7027  DATA January,February,March,April,May,June,July,August,September,October,November,December
  369. 7030  FOR I=1 TO 12
  370. 7033  READ MOY$(I)
  371. 7036  NEXT I
  372. 7039  CLS
  373. 7042  PRINT "This routine will compute the number of days between two"
  374. 7045  PRINT "dates, add or subtract an amount of time to a given date"
  375. 7048  PRINT "and determine the new date, determine the day of the week"
  376. 7051  PRINT "for a given date and produce a calender for a given month."
  377. 7054  PRINT
  378. 7057  PRINT "Which routine would you like to execute?"
  379. 7060  PRINT
  380. 7063  PRINT "1 - Determine the number of days between two dates"
  381. 7066  PRINT "2 - Determine new date for a date plus or minus a given time"
  382. 7069  PRINT "3 - Determine the day of week for a given date"
  383. 7072  PRINT "4 - Produce a calender for a given month"
  384. 7075  PRINT
  385. 7078  PRINT PR2$
  386. 7081  C=VAL(INKEY$)
  387. 7084  IF C<1 OR C>4 GOTO 7081
  388. 7087  ON C GOTO 7090,7294,7570,7675
  389. 7090  CLS
  390. 7093  C=0
  391. 7096  PRINT "Number of days between two dates."
  392. 7099  PRINT
  393. 7102  PRINT "Using the form MM-DD-YYYY"
  394. 7105  PRINT
  395. 7108  INPUT "Enter the first date     ",DATE1$
  396. 7111  IF DATE1$="" THEN DATE1$=DATE$
  397. 7114  IF DATE1$=DATE$ AND C<>1 THEN LOCATE 5,23:PRINT DATE1$
  398. 7117  YY=VAL(RIGHT$(DATE1$,4))
  399. 7120  MM=VAL(LEFT$(DATE1$,2))
  400. 7123  DD=VAL(MID$(DATE1$,4,2))
  401. 7126  IF MM>=1 AND MM<=12 GOTO 7144
  402. 7129  PRINT "Month must be 1 thru 12"
  403. 7132  LOCATE CSRLIN-2,1
  404. 7135  PRINT SPACE$(40)
  405. 7138  LOCATE CSRLIN-1,1
  406. 7141  GOTO 7108
  407. 7144  IF DD>=1 AND DD<=FND(MM) GOTO 7153
  408. 7147  PRINT "Day must be 1 thru";FND(MM)
  409. 7150  GOTO 7132
  410. 7153  Y1=YY
  411. 7156  M1=MM
  412. 7159  D1=DD
  413. 7162  GOSUB 7849
  414. 7165  A1=X
  415. 7168  A2=DW
  416. 7171  IF C=1 GOTO 7234
  417. 7174  INPUT "Enter the second date    ",DATE2$
  418. 7177  IF DATE2$="" THEN DATE2$=DATE$
  419. 7180  YY=VAL(RIGHT$(DATE2$,4))
  420. 7183  MM=VAL(LEFT$(DATE2$,2))
  421. 7186  DD=VAL(MID$(DATE2$,4,2))
  422. 7189  IF MM>=1 AND MM<=12 GOTO 7207
  423. 7192  PRINT "Month must be 1 thru 12"
  424. 7195  LOCATE CSRLIN-2,1
  425. 7198  PRINT SPACE$(40)
  426. 7201  LOCATE CSRLIN-1,1
  427. 7204  GOTO 7174
  428. 7207  IF DD>=1 AND DD<=FND(MM) GOTO 7216
  429. 7210  PRINT "Day must be 1 thru";FND(MM)
  430. 7213  GOTO 7195
  431. 7216  Y2=YY
  432. 7219  M2=MM
  433. 7222  D2=DD
  434. 7225  GOSUB 7849
  435. 7228  B1=X
  436. 7231  B2=DW
  437. 7234  CLS
  438. 7237  PRINT "First date  ";DATE1$;" a ";DOW$(A2)
  439. 7240  PRINT "Second date ";DATE2$;" a ";DOW$(B2)
  440. 7243  PRINT
  441. 7246  COLOR 15,0
  442. 7249  PRINT "The difference is ";:PRINT USING PAT5$;ABS(B1-A1);:PRINT " days."
  443. 7252  COLOR 7,0
  444. 7255  PRINT
  445. 7258  PRINT PR1$
  446. 7261  PRINT
  447. 7264  PRINT "1 - Change first date"
  448. 7267  PRINT "2 - Change second date"
  449. 7270  PRINT "3 - Return to the beginning of this routine"
  450. 7273  PRINT "4 - Return to the beginning of the date routines"
  451. 7276  PRINT "5 - Return to main menu"
  452. 7279  PRINT
  453. 7282  PRINT PR2$
  454. 7285  C=VAL(INKEY$)
  455. 7288  IF C<1 OR C>5 GOTO 7285
  456. 7291  ON C GOTO 7108,7174,7090,7039,330
  457. 7294  CLS
  458. 7297  C=0
  459. 7300  PRINT "Given date plus or minus a time period equals a new date."
  460. 7303  PRINT
  461. 7306  PRINT "Using the form MM-DD-YYYY"
  462. 7309  PRINT
  463. 7312  INPUT "Enter the date ",DATE1$
  464. 7315  IF DATE1$="" THEN DATE1$=DATE$
  465. 7318  YY=VAL(RIGHT$(DATE1$,4))
  466. 7321  MM=VAL(LEFT$(DATE1$,2))
  467. 7324  DD=VAL(MID$(DATE1$,4,2))
  468. 7327  IF MM>=1 AND MM<=12 GOTO 7339
  469. 7330  PRINT "Month must be 1 thru 12"
  470. 7333  LOCATE CSRLIN-2,1
  471. 7336  GOTO 7312
  472. 7339  IF DD>=1 AND DD<=FND(MM) GOTO 7348
  473. 7342  PRINT "Day must be 1 thru";FND(MM)
  474. 7345  GOTO 7333
  475. 7348  Y1=YY
  476. 7351  M1=MM
  477. 7354  D1=DD
  478. 7357  GOSUB 7849
  479. 7360  A1=X
  480. 7363  A2=DW
  481. 7366  IF C=1 GOTO 7483
  482. 7369  PRINT PR3$
  483. 7372  PRINT IN6$;:INPUT "",YY,MM,DD
  484. 7375  Y3=YY
  485. 7378  M3=MM
  486. 7381  D3=DD
  487. 7384  IF C=2 GOTO 7396
  488. 7387  PRINT "Plus (+) or minus (-)"
  489. 7390  A$=INKEY$
  490. 7393  IF A$<>"+" AND A$<>"-" GOTO 7390
  491. 7396  IF A$="+" THEN Y2=Y1+Y3 ELSE Y2=Y1-Y3
  492. 7399  IF A$="+" THEN M2=M1+M3 ELSE M2=M1-M3
  493. 7402  IF A$="+" THEN D2=D1+D3 ELSE D2=D1-D3
  494. 7405  IF M2>=1 AND M2<=12 GOTO 7429
  495. 7408  IF M2>12 GOTO 7420
  496. 7411  M2=M2+12
  497. 7414  Y2=Y2-1
  498. 7417  GOTO 7405
  499. 7420  M2=M2-12
  500. 7423  Y2=Y2+1
  501. 7426  GOTO 7405
  502. 7429  IF D2>=1 AND D2<=FND(M2) GOTO 7465
  503. 7432  IF D2>FND(M2) GOTO 7447
  504. 7435  M2=M2-1
  505. 7438  IF M2=0 THEN M2=12:Y2=Y2-1
  506. 7441  D2=D2+FND(M2)
  507. 7444  GOTO 7429
  508. 7447  M2=M2+1
  509. 7450  IF M2=13 THEN M2=1:Y2=Y2+1
  510. 7453  M=M2-1
  511. 7456  IF M=0 THEN M=12
  512. 7459  D2=D2-FND(M)
  513. 7462  GOTO 7429
  514. 7465  YY=Y2
  515. 7468  MM=M2
  516. 7471  DD=D2
  517. 7474  GOSUB 7849
  518. 7477  B1=X
  519. 7480  B2=DW
  520. 7483  CLS
  521. 7486  PRINT "Date of ";DATE1$;" a ";DOW$(A2)
  522. 7489  IF A$="+" THEN PRINT "Plus"; ELSE PRINT "Minus";
  523. 7492  PRINT Y3;"years";M3;"months and";D3;"days."
  524. 7495  PRINT
  525. 7498  COLOR 15,0
  526. 7501  PRINT "New date is ";
  527. 7504  PRINT USING PAT6$;M2;
  528. 7507  PRINT "-";
  529. 7510  PRINT USING PAT6$;D2;
  530. 7513  PRINT "-";
  531. 7516  PRINT USING PAT2$;Y2;
  532. 7519  PRINT " a ";DOW$(B2)
  533. 7522  PRINT "Difference of";ABS(B1-A1);"days."
  534. 7525  COLOR 7,0
  535. 7528  PRINT
  536. 7531  PRINT PR1$
  537. 7534  PRINT
  538. 7537  PRINT "1 - Change date"
  539. 7540  PRINT "2 - Change time period"
  540. 7543  PRINT "3 - Change plus or minus"
  541. 7546  PRINT "4 - Rerun using all new values"
  542. 7549  PRINT "5 - Return to beginning of date routine"
  543. 7552  PRINT "6 - Return to main menu"
  544. 7555  PRINT
  545. 7558  PRINT PR2$
  546. 7561  C=VAL(INKEY$)
  547. 7564  IF C<1 OR C>6 GOTO 7561
  548. 7567  ON C GOTO 7306,7369,7387,7294,7039,330
  549. 7570  CLS
  550. 7573  C=0
  551. 7576  PRINT "This routine will determine the day of the week"
  552. 7579  PRINT "for a given date."
  553. 7582  PRINT
  554. 7585  PRINT "Using the form MM-DD-YYYY"
  555. 7588  PRINT
  556. 7591  INPUT "Enter the date ",DATE1$
  557. 7594  IF DATE1$="" THEN DATE1$=DATE$
  558. 7597  YY=VAL(RIGHT$(DATE1$,4))
  559. 7600  MM=VAL(LEFT$(DATE1$,2))
  560. 7603  DD=VAL(MID$(DATE1$,4,2))
  561. 7606  IF MM>=1 AND MM<=12 GOTO 7618
  562. 7609  PRINT "Month must be 1 thru 12"
  563. 7612  LOCATE CSRLIN-2,1
  564. 7615  GOTO 7591
  565. 7618  IF DD>=1 AND DD<=FND(MM) GOTO 7627
  566. 7621  PRINT "Day must be 1 thru";FND(MM)
  567. 7624  GOTO 7612
  568. 7627  GOSUB 7849
  569. 7630  CLS
  570. 7633  COLOR 15,0
  571. 7636  PRINT DATE1$;" a ";DOW$(DW)
  572. 7639  COLOR 7,0
  573. 7642  PRINT
  574. 7645  PRINT PR1$
  575. 7648  PRINT
  576. 7651  PRINT "1 - Change date"
  577. 7654  PRINT "2 - Return to the beginning of the date routine"
  578. 7657  PRINT "3 - Return to main menu"
  579. 7660  PRINT
  580. 7663  PRINT PR2$
  581. 7666  C=VAL(INKEY$)
  582. 7669  IF C<1 OR C>3 GOTO 7666
  583. 7672  ON C GOTO 7591,7039,330
  584. 7675  CLS
  585. 7678  C=0
  586. 7681  PRINT "This routine will produce a one month calendar for"
  587. 7684  PRINT "a given year and month.  Since you may want to copy"
  588. 7687  PRINT "the calendar to the printer using <Shift-PrtSc>, the"
  589. 7690  PRINT "calendar is displayed and the system will wait for"
  590. 7693  PRINT "any key to be pressed before asking for a new year"
  591. 7696  PRINT "and month.  This message will not be displayed on the"
  592. 7699  PRINT "screen with the calendar."
  593. 7702  PRINT
  594. 7705  PRINT "Using the form MM-YYYY"
  595. 7708  INPUT "Enter the month and year ",DATE1$
  596. 7711  MM=VAL(LEFT$(DATE1$,2))
  597. 7714  YY=VAL(RIGHT$(DATE1$,4))
  598. 7717  IF MM>=1 AND MM<=12 GOTO 7729
  599. 7720  PRINT "The month must be between 1 thru 12."
  600. 7723  LOCATE CSRLIN-2,1
  601. 7726  GOTO 7708
  602. 7729  DD=1
  603. 7732  GOSUB 7849
  604. 7735  E=FND(MM)
  605. 7738  IF MM=2 THEN E=E+LY
  606. 7741  CLS
  607. 7744  ROW=5
  608. 7747  COL=5+10*DW
  609. 7750  T=(72-(LEN(MOY$(MM))))/2
  610. 7753  PRINT TAB(T);MOY$(MM);YY
  611. 7756  PRINT
  612. 7759  PRINT TAB(6);DOW$(0);TAB(16);DOW$(1);TAB(26);DOW$(2);TAB(35);DOW$(3);TAB(45);DOW$(4);TAB(56);DOW$(5);TAB(65);DOW$(6)
  613. 7762  PRINT
  614. 7765  LOCATE 4,1
  615. 7768  PRINT TAB(4);CHR$(218);STRING$(9,196);CHR$(194);STRING$(9,196);CHR$(194);STRING$(9,196);CHR$(194);STRING$(9,196);CHR$(194);STRING$(9,196);CHR$(194);STRING$(9,196);CHR$(194);STRING$(9,196);CHR$(191)
  616. 7771  FOR I=1 TO 5
  617. 7774  PRINT TAB(4);CHR$(179);TAB(14);CHR$(179);TAB(24);CHR$(179);TAB(34);CHR$(179);TAB(44);CHR$(179);TAB(54);CHR$(179);TAB(64);CHR$(179);TAB(74);CHR$(179)
  618. 7777  PRINT TAB(4);CHR$(179);TAB(14);CHR$(179);TAB(24);CHR$(179);TAB(34);CHR$(179);TAB(44);CHR$(179);TAB(54);CHR$(179);TAB(64);CHR$(179);TAB(74);CHR$(179)
  619. 7780  PRINT TAB(4);CHR$(195);STRING$(9,196);CHR$(197);STRING$(9,196);CHR$(197);STRING$(9,196);CHR$(197);STRING$(9,196);CHR$(197);STRING$(9,196);CHR$(197);STRING$(9,196);CHR$(197);STRING$(9,196);CHR$(180)
  620. 7783  NEXT I
  621. 7786  PRINT TAB(4);CHR$(179);TAB(14);CHR$(179);TAB(24);CHR$(179);TAB(34);CHR$(179);TAB(44);CHR$(179);TAB(54);CHR$(179);TAB(64);CHR$(179);TAB(74);CHR$(179)
  622. 7789  PRINT TAB(4);CHR$(179);TAB(14);CHR$(179);TAB(24);CHR$(179);TAB(34);CHR$(179);TAB(44);CHR$(179);TAB(54);CHR$(179);TAB(64);CHR$(179);TAB(74);CHR$(179)
  623. 7792  PRINT TAB(4);CHR$(192);STRING$(9,196);CHR$(193);STRING$(9,196);CHR$(193);STRING$(9,196);CHR$(193);STRING$(9,196);CHR$(193);STRING$(9,196);CHR$(193);STRING$(9,196);CHR$(193);STRING$(9,196);CHR$(217)
  624. 7795  FOR I=1 TO E
  625. 7798  LOCATE ROW,COL
  626. 7801  PRINT USING "##";I
  627. 7804  IF COL>=65 THEN COL=-5:ROW=ROW+3
  628. 7807  COL=COL+10
  629. 7810  NEXT I
  630. 7813  IF LEN(INKEY$)<1 GOTO 7813
  631. 7816  CLS
  632. 7819  PRINT PR1$
  633. 7822  PRINT
  634. 7825  PRINT "1 - Change date"
  635. 7828  PRINT "2 - Return to beginning of date routine"
  636. 7831  PRINT "3 - Return to main menu"
  637. 7834  PRINT
  638. 7837  PRINT PR2$
  639. 7840  C=VAL(INKEY$)
  640. 7843  IF C<1 OR C>3 GOTO 7840
  641. 7846  ON C GOTO 7705,7039,330
  642. 7849  Y=YY-1
  643. 7852  LY=0
  644. 7855  X=365*Y+FIX(Y/4)-FIX(Y/100)+FIX(Y/400)+MD(MM-1)+DD
  645. 7858  IF YY<>4*FIX(YY/4) GOTO 7873
  646. 7861  LY=1
  647. 7864  IF YY=400*FIX(YY/400) GOTO 7870
  648. 7867  IF YY=100*FIX(YY/100) THEN LY=0:GOTO 7873
  649. 7870  IF MM>=3 THEN X=X+1
  650. 7873  DW=CINT(((X/7)-FIX(X/7))*7)
  651. 7876  RETURN
  652. 8000  PRINT "This routine determines the time period for an installment"
  653. 8010  PRINT "loan given the initial loan amount, the annual interest rate,"
  654. 8020  PRINT "the periodic payment and the number of payments per year."
  655. 8030  PRINT
  656. 8040  PRINT IN7$;:INPUT "",PV
  657. 8050  IF C=1 GOTO 8120
  658. 8060  PRINT IN3$;:INPUT "",AIR
  659. 8070  IF C=2 GOTO 8110
  660. 8080  PRINT IN5$;:INPUT "",PMT
  661. 8090  IF C=3 GOTO 8120
  662. 8100  PRINT IN4$;:INPUT "",NPPY
  663. 8110  IR=AIR/(NPPY*100)
  664. 8120  IF IR*PV/PMT>1 GOTO 8370
  665. 8130  NP=-LOG(1-((IR*PV)/PMT))/LOG(1+IR)
  666. 8140  CLS
  667. 8150  PRINT PR13$;:PRINT USING PAT1$;PV
  668. 8160  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  669. 8170  PRINT PR16$;:PRINT USING PAT1$;PMT
  670. 8180  PRINT PR12$;:PRINT USING PAT2$;NPPY
  671. 8190  PRINT
  672. 8200  COLOR 15,0
  673. 8210  PRINT PR4$;:PRINT USING PAT3$;NP/NPPY;:PRINT  " years or ";:PRINT USING PAT3$;NP;:PRINT " periods."
  674. 8220  COLOR 7,0
  675. 8230  PRINT
  676. 8240  PRINT PR1$
  677. 8250  PRINT
  678. 8260  PRINT "1 - Change initial loan amount"
  679. 8270  PRINT "2 - Change annual interest rate"
  680. 8280  PRINT "3 - Change periodic payment"
  681. 8290  PRINT "4 - Change number of periods per year"
  682. 8300  PRINT "5 - Rerun using all new values"
  683. 8310  PRINT "6 - Return to main menu"
  684. 8320  PRINT
  685. 8330  PRINT PR2$
  686. 8340  C=VAL(INKEY$)
  687. 8350  IF C<1 OR C>6 GOTO 8340
  688. 8360  ON C GOTO 8040,8060,8080,8100,610,330
  689. 8370  PRINT
  690. 8380  PRINT "Values for initial loan amount, payment and interest rate"
  691. 8390  PRINT "are not reasonable.  Payment must be greater than the initial
  692. 8400  PRINT "loan amount time the periodic interest rate."
  693. 8410  PRINT
  694. 8420  PRINT "Hit any key to return to the beginning of this routine."
  695. 8430  IF LEN(INKEY$)<1 GOTO 8430
  696. 8440  GOTO 610
  697. 9000  PRINT "This routine determines the present value of a series of"
  698. 9010  PRINT "payments, given the periodic payment, the annual interest"
  699. 9020  PRINT "rate, the number of payments per year and the number of"
  700. 9030  PRINT "payments remaining.  This is normally used to determine the"
  701. 9040  PRINT "amount remaining on a loan."
  702. 9050  PRINT
  703. 9060  PRINT IN5$;:INPUT "",PMT
  704. 9070  IF C=1 GOTO 9150
  705. 9080  PRINT IN3$;:INPUT "",AIR
  706. 9090  IF C=2 GOTO 9150
  707. 9100  PRINT IN4$;:INPUT "",NPPY
  708. 9110  IF C=3 GOTO 9140
  709. 9120  PRINT PR3$
  710. 9130  PRINT IN6$;:INPUT "",YY,MM,DD
  711. 9140  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  712. 9150  IR=AIR/(NPPY*100)
  713. 9160  PV=PMT*((1-(1+IR)^(-NP))/IR)
  714. 9170  CLS
  715. 9180  PRINT PR16$;:PRINT USING PAT1$;PMT
  716. 9190  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  717. 9200  PRINT PR12$;:PRINT USING PAT2$;NPPY
  718. 9210  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  719. 9220  PRINT
  720. 9230  COLOR 15,0
  721. 9240  PRINT PR9$;:PRINT USING PAT1$;PV
  722. 9250  COLOR 7,0
  723. 9260  PRINT
  724. 9270  PRINT PR1$
  725. 9280  PRINT
  726. 9290  PRINT "1 - Change periodic payment"
  727. 9300  PRINT "2 - Change annual interest rate"
  728. 9310  PRINT "3 - Change number of payments per year"
  729. 9320  PRINT "4 - Change time period"
  730. 9330  PRINT "5 - Rerun using all new values"
  731. 9340  PRINT "6 - Return to main menu"
  732. 9350  PRINT
  733. 9360  PRINT PR2$
  734. 9370  C=VAL(INKEY$)
  735. 9380  IF C<1 OR C>6 GOTO 9370
  736. 9390  ON C GOTO 9060,9080,9100,9120,610,330
  737. 11000  PRINT "This routine figures the nominal and effective"
  738. 11010  PRINT "interest rates when given the present value, future"
  739. 11020  PRINT "value, number of periods per year and the time period."
  740. 11030  PRINT
  741. 11040  PRINT IN1$;:INPUT "",PV
  742. 11050  IF C=1 GOTO 11130
  743. 11060  PRINT IN2$;:INPUT "",FV
  744. 11070  IF C=2 GOTO 11130
  745. 11080  PRINT IN4$;:INPUT "",NPPY
  746. 11090  IF C=3 GOTO 11120
  747. 11100  PRINT PR3$
  748. 11110  PRINT IN6$;:INPUT "",YY,MM,DD
  749. 11120  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  750. 11130  ER=((FV/PV)^(NPPY/NP)-1)*100
  751. 11140  NR=(NPPY*((FV/PV)^(1/NP))-NPPY)*100
  752. 11150  CLS
  753. 11160  PRINT PR9$;:PRINT USING PAT1$;PV
  754. 11170  PRINT PR10$;:PRINT USING PAT1$;FV
  755. 11180  PRINT PR12$;:PRINT USING PAT2$;NPPY
  756. 11190  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  757. 11200  PRINT
  758. 11210  COLOR 15,0
  759. 11220  PRINT "Nominal annual interest rate is   ";:PRINT USING PAT3$;NR;:PRINT " %"
  760. 11230  PRINT
  761. 11240  PRINT "Effective annual interest rate is ";:PRINT USING PAT3$;ER;:PRINT " %"
  762. 11250  COLOR 7,0
  763. 11260  PRINT
  764. 11270  PRINT PR1$
  765. 11280  PRINT
  766. 11290  PRINT "1 - Change present value"
  767. 11300  PRINT "2 - Change future value"
  768. 11310  PRINT "3 - Change number of periods per year"
  769. 11320  PRINT "4 - Change time period"
  770. 11330  PRINT "5 - Rerun using all new values"
  771. 11340  PRINT "6 - Return to main menu"
  772. 11350  PRINT
  773. 11360  PRINT PR2$
  774. 11370  C=VAL(INKEY$)
  775. 11380  IF C<1 OR C>6 GOTO 11370
  776. 11390  ON C GOTO 11040,11060,11080,11100,610,330
  777. 12000  PRINT "This program figures the internal rate of return on an"
  778. 12010  PRINT "investment given the purchase price, expected future"
  779. 12020  PRINT "value, the time period and the earnings for each period."
  780. 12030  PRINT
  781. 12040  PRINT IN1$;:INPUT "",PV
  782. 12050  IF C=1 GOTO 12260
  783. 12060  PRINT IN2$;:INPUT "",FV
  784. 12070  IF C=2 GOTO 12260
  785. 12080  PRINT IN4$;:INPUT "",NPPY
  786. 12090  IF C=3 GOTO 12120
  787. 12100  PRINT PR3$
  788. 12110  PRINT IN6$;:INPUT "",YY,MM,DD
  789. 12120  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  790. 12130  GOSUB 12580
  791. 12140  PRINT "Enter the earnings for each period."
  792. 12150  PRINT
  793. 12160  PRINT "      Period      Period"
  794. 12170  PRINT "      Number     Earnings"
  795. 12180  FOR I=1 TO NP
  796. 12190  PRINT SPACE$(6);
  797. 12200  PRINT USING PAT2$;I;
  798. 12210  PRINT SPACE$(20);
  799. 12220  LOCATE CSRLIN,POS(1)-12
  800. 12230  INPUT "",PE(I)
  801. 12240  LOCATE CSRLIN-1,1
  802. 12250  NEXT I
  803. 12260  IR=0.15/NPPY
  804. 12270  I1=0.25
  805. 12280  PVFV=FV/(1+IR)^NP
  806. 12290  TPVE=0
  807. 12300  FOR I=1 TO NP
  808. 12310  PVPE=PE(I)/(1+IR)^I
  809. 12320  TPVE=TPVE+PVPE
  810. 12330  NEXT I
  811. 12340  I1=IR*(PVFV+TPVE)/PV
  812. 12350  LOCATE 25,1
  813. 12360  PRINT USING PAT4$;ABS(IR-I1);
  814. 12370  IF ABS(IR-I1)>9.99E-07 THEN IR=I1:GOTO 12280
  815. 12380  AIR=IR*NPPY*100
  816. 12390  GOSUB 12580
  817. 12400  COLOR 15,0
  818. 12410  PRINT "Internal rate of return is ";:PRINT USING PAT3$;AIR;:PRINT " %"
  819. 12420  COLOR 7,0
  820. 12430  PRINT
  821. 12440  PRINT PR1$
  822. 12450  PRINT
  823. 12460  PRINT "1 - Change present value"
  824. 12470  PRINT "2 - Change future value"
  825. 12480  PRINT "3 - Change number of periods per year"
  826. 12490  PRINT "4 - Change time period"
  827. 12500  PRINT "5 - Change periodic earnings"
  828. 12510  PRINT "6 - Rerun using all new values"
  829. 12520  PRINT "7 - Return to main menu"
  830. 12530  PRINT
  831. 12540  PRINT PR2$
  832. 12550  C=VAL(INKEY$)
  833. 12560  IF C<1 OR C>7 GOTO 12550
  834. 12570  ON C GOTO 12040,12060,12080,12100,12140,610,330
  835. 12580  CLS
  836. 12590  PRINT PR9$;:PRINT USING PAT1$;PV
  837. 12600  PRINT PR10$;:PRINT USING PAT1$;FV
  838. 12610  PRINT PR12$;:PRINT USING PAT2$;NPPY
  839. 12620  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  840. 12630  PRINT
  841. 12640  RETURN
  842. 13000  PRINT "This routine calculates the future value of"
  843. 13010  PRINT "regular deposits, given the periodic deposit,"
  844. 13020  PRINT "the annual interest rate and time period.  An"
  845. 13030  PRINT "assumption is that the interest is compounded"
  846. 13040  PRINT "coincident with the deposits."
  847. 13050  PRINT
  848. 13060  PRINT IN5$;:INPUT "",PMT
  849. 13070  IF C=1 GOTO 13160
  850. 13080  PRINT IN3$;:INPUT "",AIR
  851. 13090  IF C=2 GOTO 13150
  852. 13100  PRINT IN4$;:INPUT "",NPPY
  853. 13110  IF C=3 GOTO 13140
  854. 13120  PRINT PR3$
  855. 13130  PRINT IN6$;:INPUT "",YY,MM,DD
  856. 13140  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  857. 13150  IR=AIR/(NPPY*100)
  858. 13160  FV=(PMT/IR)*(((1+IR)^(NP+1))-(1+IR))
  859. 13170  CLS
  860. 13180  PRINT PR16$;:PRINT USING PAT1$;PMT
  861. 13190  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  862. 13200  PRINT PR12$;:PRINT USING PAT2$;NPPY
  863. 13210  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  864. 13220  PRINT
  865. 13230  COLOR 15,0
  866. 13240  PRINT PR10$;:PRINT USING PAT1$;FV
  867. 13250  COLOR 7,0
  868. 13260  PRINT
  869. 13270  PRINT PR1$
  870. 13280  PRINT
  871. 13290  PRINT "1 - Change periodic payment"
  872. 13300  PRINT "2 - Change annual interest rate"
  873. 13310  PRINT "3 - Change number of periods per year"
  874. 13320  PRINT "4 - Change time period"
  875. 13330  PRINT "5 - Rerun using all new values"
  876. 13340  PRINT "6 - Return to main menu"
  877. 13350  PRINT
  878. 13360  PRINT PR2$
  879. 13370  C=VAL(INKEY$)
  880. 13380  IF C<1 OR C>6 GOTO 13370
  881. 13390  ON C GOTO 13060,13080,13100,13120,610,330
  882. 14000  PRINT "This routine calculates the regular deposits needed"
  883. 14010  PRINT "to produce a specified future value, given the annual"
  884. 14020  PRINT "interest rate and time period.  An assumption is that"
  885. 14030  PRINT "the interest is compounded coincident with the deposits."
  886. 14040  PRINT
  887. 14050  PRINT IN2$;:INPUT "",FV
  888. 14060  IF C=1 GOTO 14150
  889. 14070  PRINT IN3$;:INPUT "",AIR
  890. 14080  IF C=2 GOTO 14140
  891. 14090  PRINT IN4$;:INPUT "",NPPY
  892. 14100  IF C=3 GOTO 14130
  893. 14110  PRINT PR3$
  894. 14120  PRINT IN6$;:INPUT "",YY,MM,DD
  895. 14130  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  896. 14140  IR=AIR/(NPPY*100)
  897. 14150  PMT=(FV*IR)/(((1+IR)^(NP+1))-(1+IR))
  898. 14160  CLS
  899. 14170  PRINT PR10$;:PRINT USING PAT1$;FV
  900. 14180  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  901. 14190  PRINT PR12$;:PRINT USING PAT2$;NPPY
  902. 14200  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  903. 14210  PRINT
  904. 14220  COLOR 15,0
  905. 14230  PRINT PR16$;:PRINT USING PAT1$;PMT
  906. 14240  COLOR 7,0
  907. 14250  PRINT
  908. 14260  PRINT PR1$
  909. 14270  PRINT
  910. 14280  PRINT "1 - Change future value"
  911. 14290  PRINT "2 - Change annual interest rate"
  912. 14300  PRINT "3 - Change number of periods per year"
  913. 14310  PRINT "4 - Change time period"
  914. 14320  PRINT "5 - Rerun using all new values"
  915. 14330  PRINT "6 - Return to main menu"
  916. 14340  PRINT
  917. 14350  PRINT PR2$
  918. 14360  C=VAL(INKEY$)
  919. 14370  IF C<1 OR C>6 GOTO 14360
  920. 14380  ON C GOTO 14050,14070,14090,14110,610,330
  921. 15000  PRINT "This program determines the amount of depreciation for"
  922. 15010  PRINT "each period by applying a specified depreciation rate"
  923. 15020  PRINT "percentage to the given original value."
  924. 15030  PRINT
  925. 15040  INPUT "Original price, in dollars      $ ",PV
  926. 15050  IF C=1 GOTO 15140
  927. 15060  INPUT "Annual depreciation rate, in %    ",ADR
  928. 15070  IF C=2 GOTO 15130
  929. 15080  PRINT IN4$;:INPUT "",NPPY
  930. 15090  IF C=3 GOTO 15120
  931. 15100  PRINT PR3$
  932. 15110  PRINT IN6$;:INPUT "",YY,MM,DD
  933. 15120  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  934. 15130  DR=ADR/(NPPY*100)
  935. 15140  TD=0
  936. 15150  B=1
  937. 15160  E=B+11
  938. 15170  IF E>NP THEN E=NP
  939. 15180  CLS
  940. 15190  PRINT "Original value      ";:PRINT USING PAT1$;PV
  941. 15200  PRINT "Annual depreciation rate    ";:PRINT USING PAT3$;ADR;:PRINT " %"
  942. 15210  PRINT PR12$;:PRINT USING PAT2$;NPPY
  943. 15220  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  944. 15230  PRINT
  945. 15240  PRINT "Period  ";"Depreciation";"   Remainder"
  946. 15250  COLOR 15,0
  947. 15260  FOR I=B TO E
  948. 15270  DP=DR*PV*(1-DR)^(I-1)
  949. 15280  TD=TD+DP
  950. 15290  PRINT USING PAT2$;I;:PRINT USING PAT1$;DP,PV-TD
  951. 15300  NEXT I
  952. 15310  COLOR 7,0
  953. 15320  PRINT
  954. 15330  PRINT "Press ENTER to continue with next 12 periods.  Enter a beginning"
  955. 15340  INPUT "period number if desired or enter 0 to quit    ",A$
  956. 15350  IF A$<>"" GOTO 15420
  957. 15360  IF E<>NP GOTO 15400
  958. 15370  LOCATE CSRLIN-2,1
  959. 15380  PRINT "Period";:PRINT USING PAT2$;YY;:PRINT " was the last period.                Enter a beginning"
  960. 15390  GOTO 15340
  961. 15400  B=B+12
  962. 15410  GOTO 15160
  963. 15420  IF A$=" " OR A$="0" GOTO 15480
  964. 15430  B=VAL(A$)
  965. 15440  IF B>=1 AND B<=YY GOTO 15160
  966. 15450  PRINT "Input was not 0 to quit, blank to continue, or between 1 and";YY
  967. 15460  LOCATE CSRLIN-3,1
  968. 15470  GOTO 15330
  969. 15480  CLS
  970. 15490  PRINT "Original value      ";:PRINT USING PAT1$;PV
  971. 15500  PRINT "Annual depreciation rate    ";:PRINT USING PAT3$;ADR;:PRINT " %"
  972. 15510  PRINT PR12$;:PRINT USING PAT2$;NPPY
  973. 15520  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  974. 15530  PRINT
  975. 15540  PRINT PR1$
  976. 15550  PRINT
  977. 15560  PRINT "1 - Change original price"
  978. 15570  PRINT "2 - Change annual depreciation rate"
  979. 15580  PRINT "3 - Change number of periods per year"
  980. 15590  PRINT "4 - Change time period"
  981. 15600  PRINT "5 - Rerun this program using all new values"
  982. 15610  PRINT "6 - Return to main menu"
  983. 15620  PRINT
  984. 15630  PRINT PR2$
  985. 15640  C=VAL(INKEY$)
  986. 15650  IF C<1 OR C>6 GOTO 15640
  987. 15660  ON C GOTO 15040,15060,15080,15100,610,330
  988. 16000  PRINT "This program determines the depreciation rate if the"
  989. 16010  PRINT "present value, future value, and holding time are known."
  990. 16020  PRINT
  991. 16030  PRINT IN1$;:INPUT "",PV
  992. 16040  IF C=1 GOTO 16120
  993. 16050  PRINT IN2$;:INPUT "",FV
  994. 16060  IF C=2 GOTO 16120
  995. 16070  PRINT IN4$;:INPUT "",NPPY
  996. 16080  IF C=3 GOTO 16110
  997. 16090  PRINT PR3$
  998. 16100  PRINT IN6$;:INPUT "",YY,MM,DD
  999. 16110  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  1000. 16120  DR=(1-(FV/PV)^(1/NP))*100*NPPY
  1001. 16130  CLS
  1002. 16140  PRINT
  1003. 16150  PRINT PR9$;:PRINT USING PAT1$;PV
  1004. 16160  PRINT PR10$;:PRINT USING PAT1$;FV
  1005. 16170  PRINT PR11$;:PRINT USING PAT2$;NPPY
  1006. 16180  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  1007. 16190  PRINT
  1008. 16200  COLOR 15,0
  1009. 16210  PRINT "The depreciation rate is    ";:PRINT USING PAT3$;DR;:PRINT " %"
  1010. 16220  COLOR 7,0
  1011. 16230  PRINT
  1012. 16240  PRINT PR1$
  1013. 16250  PRINT
  1014. 16260  PRINT "1 - Change persent value"
  1015. 16270  PRINT "2 - Change future value"
  1016. 16280  PRINT "3 - Change number of periods per year"
  1017. 16290  PRINT "4 - Change time period"
  1018. 16300  PRINT "5 - Rerun using all new values"
  1019. 16310  PRINT "6 - Return to main menu"
  1020. 16320  PRINT
  1021. 16330  PRINT PR2$
  1022. 16340  C=VAL(INKEY$)
  1023. 16350  IF C<1 OR C>6 GOTO 16340
  1024. 16360  ON C GOTO 16030,16050,16070,16090,610,330
  1025. 17000  PRINT "This program determines the salvage value of an item"
  1026. 17010  PRINT "given the original price, annual depreciation rate"
  1027. 17020  PRINT "and it's age."
  1028. 17030  PRINT
  1029. 17040  INPUT "Original price, in dollars   $ ",OP
  1030. 17050  IF C=1 GOTO 17140
  1031. 17060  INPUT "Annual depreciation rate, in % ",ADR
  1032. 17070  IF C=2 GOTO 17130
  1033. 17080  PRINT IN4$;:INPUT "",NPPY
  1034. 17090  IF C=3 GOTO 17120
  1035. 17100  PRINT PR3$
  1036. 17110  PRINT IN6$;:INPUT "",YY,MM,DD
  1037. 17120  NP=CINT(NPPY*(YY+MM/12+DD365.25))
  1038. 17130  DR=ADR/(NPPY*100)
  1039. 17140  SV=OP*(1-DR)^NP
  1040. 17150  CLS
  1041. 17160  PRINT "Original price       ";:PRINT USING PAT1$;OP
  1042. 17170  PRINT "Annual depreciation rate     ";:PRINT USING PAT3$;ADR;:PRINT " %"
  1043. 17180  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  1044. 17190  PRINT
  1045. 17200  COLOR 15,0
  1046. 17210  PRINT "The salvage value is ";:PRINT USING PAT1$;SV
  1047. 17220  COLOR 7,0
  1048. 17230  PRINT
  1049. 17240  PRINT PR1$
  1050. 17250  PRINT
  1051. 17260  PRINT "1 - Change original price"
  1052. 17270  PRINT "2 - Change annual depreciation rate"
  1053. 17280  PRINT "3 - Change number of periods per year"
  1054. 17290  PRINT "4 - Change time period"
  1055. 17300  PRINT "5 - Rerun using all new values"
  1056. 17310  PRINT "6 - Return to main menu"
  1057. 17320  PRINT
  1058. 17330  PRINT PR2$
  1059. 17340  C=VAL(INKEY$)
  1060. 17350  IF C<1 OR C>6 GOTO 17340
  1061. 17360  ON C GOTO 17040,17060,17080,17100,610,330
  1062. 19000  PRINT "This program determines the present value of a coupon"
  1063. 19010  PRINT "bond given the face amount, periodic payment, annual"
  1064. 19020  PRINT "interest rate, number of periods per year and the"
  1065. 19030  PRINT "time period of the bond"
  1066. 19040  PRINT
  1067. 19050  INPUT "Face amount, in dollars          $ ",FV
  1068. 19060  IF C=1 GOTO 19170
  1069. 19070  PRINT IN5$;:INPUT "",PMT
  1070. 19080  IF C=2 GOTO 19170
  1071. 19090  PRINT IN3$;:INPUT "",AIR
  1072. 19100  IF C=3 GOTO 19160
  1073. 19110  PRINT IN4$;:INPUT "",NPPY
  1074. 19120  IF C=4 GOTO 19150
  1075. 19130  PRINT PR3$
  1076. 19140  PRINT IN6$;:INPUT "",YY,MM,DD
  1077. 19150  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  1078. 19160  IR=AIR/(NPPY*100)
  1079. 19170  PV=PMT*(1-(1+IR)^(-NP))/IR+FV/(1+IR)^(NP)
  1080. 19180  CLS
  1081. 19190  PRINT PR10$;:PRINT USING PAT1$;FV
  1082. 19200  PRINT PR16$;:PRINT USING PAT1$;PMT
  1083. 19210  PRINT PR11$;:PRINT USING PAT3$;AIR;:PRINT " %"
  1084. 19220  PRINT PR12$;:PRINT USING PAT2$;NPPY
  1085. 19230  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  1086. 19240  PRINT
  1087. 19250  COLOR 15,0
  1088. 19260  PRINT PR9$;:PRINT USING PAT1$;PV
  1089. 19270  COLOR 7,0
  1090. 19280  PRINT
  1091. 19290  PRINT PR1$
  1092. 19300  PRINT
  1093. 19310  PRINT "1 - Change future value"
  1094. 19320  PRINT "2 - Change periodic payment"
  1095. 19330  PRINT "3 - Change annual interest rate"
  1096. 19340  PRINT "4 - Change number of periods per year"
  1097. 19350  PRINT "5 - Change time period"
  1098. 19360  PRINT "6 - Rerun using all new values"
  1099. 19370  PRINT "7 - Return to main menu"
  1100. 19380  PRINT
  1101. 19390  PRINT PR2$
  1102. 19400  C=VAL(INKEY$)
  1103. 19410  IF C<1 OR C>7 GOTO 19400
  1104. 19420  ON C GOTO 19050,19070,19090,19110,19130,610,330
  1105. 20000  PRINT "This program determines the yield to maturity on
  1106. 20010  PRINT "a bond given the current purchase price.  This is
  1107. 20020  PRINT "the true rate of return on a bond.
  1108. 20030  PRINT
  1109. 20040  PRINT IN1$;:INPUT "",PV
  1110. 20050  IF C=1 GOTO 20150
  1111. 20060  PRINT IN2$;:INPUT "",FV
  1112. 20070  IF C=2 GOTO 20150
  1113. 20080  PRINT IN5$;:INPUT "",PMT
  1114. 20090  IF C=3 GOTO 20150
  1115. 20100  PRINT IN4$;:INPUT "",NPPY
  1116. 20110  IF C=4 GOTO 20140
  1117. 20120  PRINT PR3$
  1118. 20130  PRINT IN6$;:INPUT "",YY,MM,DD
  1119. 20140  NP=CINT(NPPY*(YY+MM/12+DD/365.25))
  1120. 20150  IR=0.08/NPPY
  1121. 20160  PF=FV/(1+IR)^NP
  1122. 20170  T=(1+IR)^(-NP):T=1-T:T=T/IR*PMT
  1123. 20180  I1=IR*(PF+T)/PV
  1124. 20190  LOCATE 25,1
  1125. 20200  PRINT USING PAT4$;ABS(IR-I1);
  1126. 20210  IF ABS(IR-I1)>9.99E-07 THEN IR=I1:GOTO 20160
  1127. 20220  AIR=IR*NPPY*100
  1128. 20230  CLS
  1129. 20240  PRINT PR9$;:PRINT USING PAT1$;PV
  1130. 20250  PRINT PR10$;:PRINT USING PAT1$;FV
  1131. 20260  PRINT PR16$;:PRINT USING PAT1$;PMT
  1132. 20270  PRINT PR12$;:PRINT USING PAT2$;NPPY
  1133. 20280  PRINT PR4$;YY;PR5$;MM;PR6$;DD;PR7$;NP;PR8$
  1134. 20290  PRINT
  1135. 20300  COLOR 15,0
  1136. 20310  PRINT "Yield to maturity is       ";:PRINT USING PAT3$;AIR;:PRINT " %"
  1137. 20320  COLOR 7,0
  1138. 20330  PRINT
  1139. 20340  PRINT PR1$
  1140. 20350  PRINT
  1141. 20360  PRINT "1 - Change purchase price"
  1142. 20370  PRINT "2 - Change future value"
  1143. 20380  PRINT "3 - Change periodic payment"
  1144. 20390  PRINT "4 - Change number of periods per year"
  1145. 20400  PRINT "5 - Change time period"
  1146. 20410  PRINT "6 - Rerun using all new values"
  1147. 20420  PRINT "7 - Return to main menu"
  1148. 20430  PRINT
  1149. 20440  PRINT PR2$
  1150. 20450  C=VAL(INKEY$)
  1151. 20460  IF C<1 OR C>7 GOTO 20450
  1152. 20470  ON C GOTO 20040,20060,20080,20100,20120,610,330
  1153.